#pragma once
#include <gfw.h>
#include <inttypes.h>
#include <vector>
#include <regex.h>

typedef struct {
    char *name;
    char *id;
}group_info;
using namespace std;

class HttpQQ ;
class QQGroup
{
private:
    HttpQQ *qq;
public:
    QQGroup(HttpQQ *http_qq,char *group_id,const char *name);
    char *id;
    char *name;
    char *gonggao;
    bool ChangeGonggao(char *gonggao);
    bool LoadGonggao(); 
};

class HttpQQ 
{
private:
    vector<group_info> ParseGroupList(const char *html);
    char *cookie_path;
public:
    gfw_request *request;
    uint32_t qq;
    char *datadir;
    char *verify_image;
    vector<class QQGroup *> groups;
    HttpQQ(const char *data_dir);
    ~HttpQQ();
    bool InitLogin();
    bool InitWithCookie(uint32_t qq);
    bool Login(uint32_t qq,char *password,char *verify_code);
    bool LoadGroup(); 
};

